package com.itheima.tlias08_14.utils;

import lombok.Data;

import java.util.HashMap;
import java.util.List;

@Data
public class ResultUtilEmp {
    private int code;
    private String msg;
    private HashMap<String,Object> data;




    public static ResultUtilEmp success(int total, List list){
        ResultUtilEmp resultUtil = new ResultUtilEmp();
        resultUtil.setCode(1);
        resultUtil.setMsg("success");
        HashMap<String, Object> data = new HashMap<>();
        data.put("total",total);
        data.put("rows",list);
        resultUtil.setData(data);
        return resultUtil;
    }
    public static ResultUtilEmp success(){
        ResultUtilEmp resultUtil = new ResultUtilEmp();
        resultUtil.setCode(1);
        resultUtil.setMsg("success");
        return resultUtil;
    }

    public static ResultUtilEmp failure(){
        ResultUtilEmp resultUtil = new ResultUtilEmp();
        resultUtil.setCode(0);
        resultUtil.setMsg("false");
        return resultUtil;
    }
    public static ResultUtilEmp failure(String msg){
        ResultUtilEmp resultUtil = new ResultUtilEmp();
        resultUtil.setCode(0);
        resultUtil.setMsg(msg);
        return resultUtil;
    }


}
